package com.sp.common.config;

import com.sp.common.utils.MD5Util;
import org.springframework.security.crypto.password.PasswordEncoder;

public class Md5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {

        return  MD5Util.GetMD5Code(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return MD5Util.GetMD5Code(rawPassword.toString()).equalsIgnoreCase(encodedPassword);
    }
}
